package com.heima.admin.controller;

import com.heima.apis.dotos.ChannelDto;
import com.heima.apis.wemedia.IWmChannelClient;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/channel")
public class WmChannelController {

    @Autowired
    private IWmChannelClient wmChannelClient;


    @PostMapping("/list")
    public PageResponseResult pageList(@RequestBody ChannelDto dto){
        return wmChannelClient.pageList(dto);
    }

    @PostMapping("/save")
    public ResponseResult save(@RequestBody WmChannel adChannel){
       return wmChannelClient.saveWmChannel(adChannel);
    }

    @PostMapping("/update")
    public ResponseResult update(@RequestBody WmChannel adChannel){
        return wmChannelClient.updateWnChannel(adChannel);
    }

    @GetMapping("/del/{id}")
    public ResponseResult delete(@PathVariable("id") Integer id){
        return wmChannelClient.delWmChannel(id);
    }

}
